package cn.jw.starter.common.current;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 王广帅
 * @version 1.0.0
 * @since 2025/11/22 18:19
 */
public class JwThreadFactory implements ThreadFactory {

    private String name;
    private static AtomicInteger idGen = new AtomicInteger();

    public JwThreadFactory(String name) {
        this.name = name;
    }

    @Override
    public Thread newThread(Runnable r) {
        Thread t = new Thread(r, this.name + "-" + idGen.incrementAndGet());
        return t;
    }
}
